Skip to content

Add Azure Artifacts npm authentication refresh - #2339

Merged
SteveSandersonMS merged 3 commits into
mainfrom
mackinnonbuck-add-sdk-npm-auth
Sep 10, 2026
Merged

SteveSandersonMS merged 3 commits into
mainfrom
mackinnonbuck-add-sdk-npm-auth

Conversation

@MackinnonBuck

Copy link
Copy Markdown
Collaborator

Summary

  • add a guarded Azure Artifacts npm authentication refresh script for the repository's three nested npm packages
  • keep project configs scoped to @github while storing credentials at user level
  • document Microsoft contributor setup and cover platform commands, CLI gating, config output, and error propagation

Validation

  • npm test -- npm-auth-refresh.test.ts (15 passed)
  • npm run lint (passed with 3 existing warnings)
  • npm run typecheck
  • npx tsc --noEmit --strict --skipLibCheck --module NodeNext --moduleResolution NodeNext --target ES2022 --esModuleInterop test\npm-auth-refresh.test.ts
  • npx prettier --config .prettierrc.json --check test\npm-auth-refresh.test.ts ..\scripts\npm-auth-refresh.mjs ..\scripts\npm-auth-refresh.d.mts
  • node .\scripts\npm-auth-refresh.mjs --help

npm run format:check was also run; on this Windows checkout it reports existing CRLF formatting drift in 104 untouched Node files. All new auth files pass the targeted Prettier check above.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 14, 2026 22:46
@MackinnonBuck
MackinnonBuck requested a review from a team as a code owner August 14, 2026 22:46
Comment thread scripts/npm-auth-refresh.mjs Fixed
@github-actions github-actions Bot mentioned this pull request Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cross-platform Azure Artifacts npm authentication setup for Microsoft contributors.

Changes:

  • Adds guarded credential refresh and scoped .npmrc generation.
  • Adds comprehensive Vitest coverage.
  • Documents setup and ignores generated configurations.
Show a summary per file
File Description
scripts/npm-auth-refresh.mjs Implements configuration and authentication refresh.
scripts/npm-auth-refresh.d.mts Declares script types.
nodejs/test/npm-auth-refresh.test.ts Tests CLI and platform behavior.
nodejs/package.json Adds the refresh command.
CONTRIBUTING.md Documents contributor setup.
.gitignore Ignores generated .npmrc files.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 5/6 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread scripts/npm-auth-refresh.mjs Outdated
Comment thread scripts/npm-auth-refresh.mjs Outdated

@SteveSandersonMS SteveSandersonMS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 32 — writeProjectNpmConfigs unconditionally overwrites .npmrc files, erasing any pre-existing unrelated settings. Should either merge the @github:registry key into existing content or reject if the file exists and wasn't generated by this script.

Line 63 — Non-Windows path missing -f/--force flag for artifacts-npm-credprovider. Without it, the documented 'rerun after Azure 401/403' recovery step won't force a fresh token refresh on mac/Linux.

Line 88 — CodeQL alert: shell command built from process.env.ComSpec. Either hardcode the interpreter or validate/sanitize the env value.

@SteveSandersonMS SteveSandersonMS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of technical issues

Comment thread scripts/npm-auth-refresh.mjs Outdated
Comment thread scripts/npm-auth-refresh.mjs Outdated
Comment thread scripts/npm-auth-refresh.mjs
@SteveSandersonMS

Copy link
Copy Markdown
Contributor

The PR addresses a legitimate internal Azure Artifacts npm-auth need, but two bugs were independently reproduced and a third requires confirmation: existing .npmrc files are overwritten, Windows trusts ComSpec as an executable, and non-Windows force-refresh behavior is unclear.

The PR is now draft for tracking. Please address these items and mark it ready for review once the changes are complete.

@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Rechecked PR #2339 since the prior pass: there are no new commits, issue comments, review comments, reviews, or author response. The PR remains Draft and blocked with the same unresolved issues. No code changed, so there was nothing new to retest manually.

Please address the requested fixes and mark the PR ready for review when complete.

Preserve local npm settings, force Unix credential refresh, and keep Windows command execution independent of ComSpec and repository path arguments. Document running the helper from the repository root.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee3a1493-bf0d-4e08-9e13-03b3999affe0
@MackinnonBuck
MackinnonBuck marked this pull request as ready for review September 8, 2026 21:13
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

SDK Consistency Review

Reviewed the changed files in this PR:

  • .gitignore, CONTRIBUTING.md (docs/repo hygiene)
  • nodejs/package.json (adds an auth:refresh script)
  • nodejs/test/npm-auth-refresh.test.ts, scripts/npm-auth-refresh.mjs, scripts/npm-auth-refresh.d.mts (new internal tooling)

This PR introduces a local developer-tooling script (npm-auth-refresh) used to refresh Azure Artifacts auth tokens for npm, along with its test and .gitignore entries for generated .npmrc files. It does not touch any SDK client code, public API surface, or feature implementation in the Node.js, Python, Go, .NET, Java, or Rust SDKs.

Since this is purely internal build/auth tooling scoped to the Node.js package's dev workflow (not a client-facing SDK feature), there is no cross-language consistency requirement here — no action needed for other SDKs.

Generated by SDK Consistency Review Agent for #2339 · copilot · sonnet50 · 10.7 AIC · ⌖ 11.9 AIC · ⊞ 9.7K · ◷

@SteveSandersonMS SteveSandersonMS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed the requested fixes are in place in 1022970: .npmrc updates now preserve unrelated settings while consolidating @github:registry, Windows no longer trusts ComSpec and uses cwd, and Unix auth now forces refresh with -f. Regression coverage for these scenarios is present and focused validation is green.

The remaining Java win32-arm64 required-check failure appears unrelated CI noise based on the run log; once that is rerun/cleared this should be good to merge.

@SteveSandersonMS
SteveSandersonMS added this pull request to the merge queue Sep 10, 2026
@SteveSandersonMS
SteveSandersonMS removed this pull request from the merge queue due to a manual request Sep 10, 2026
@SteveSandersonMS
SteveSandersonMS merged commit 0024a45 into main Sep 10, 2026
185 of 187 checks passed
@SteveSandersonMS
SteveSandersonMS deleted the mackinnonbuck-add-sdk-npm-auth branch September 10, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants